package com.andy.springboot.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.andy.springboot.annotation.IgnoreLoginCheck;
import com.andy.springboot.dto.ResponseResult;
import com.andy.springboot.service.UserService;

import io.swagger.annotations.ApiOperation;

@RestController
@IgnoreLoginCheck
public class UserController extends BaseController {

	@Autowired
	private UserService userService;

	@ApiOperation("获取用户信息")
	@RequestMapping(value = "/user/{userId}", method = RequestMethod.GET)
	public ResponseResult getUserInfo(HttpSession session, @PathVariable long userId) {
		ResultDelegate delegate = new ResultDelegate() {

			@Override
			public Object getResultObject() {
				return userService.getUserInfo(userId);
			}
		};
		return getResponseResult(delegate);
	};
}
